<?php

class Core_Action_Admin_System_Mail_Transport_Add extends Action_Admin
{
	function execute($request, $initial = FALSE, $script = NULL)
	{
		if ($initial)
		{
			Agilet::setVar('breadcrum', array(
				array(
					'url' => 'admin/system',
					'label' => 'System'
				),
				array(
					'url' => 'admin/system/mail',
					'label' => 'Mail'
				),
				array(
					'url' => 'admin/system/mail/transport',
					'label' => 'Transport'
				),
				array(
					'url' => 'admin/system/mail/transport/choose',
					'label' => 'Choose Service'
				)
			));
		}

		$table = Model::getTable('core/mail/service');

		$select = $table -> select() -> order('sort_order') -> order('title');

		$items = $table -> fetchAll($select);

		$request -> response = View::render($script = 'core/html/admin/system/mail/transport/add', $data = array(
			'items' => $items,
			'title' => 'admin_choose_mail_service_title'
		));
	}

}
